#ifndef __GAF_COMMAND_H__
#define __GAF_COMMAND_H__

#include "GAF_Define.h"

namespace GAF
{
	struct Command;
}
typedef GAF::Command				GAF_SCommand;

namespace GAF
{
	/// 系统命令枚举
	enum CommandType
	{
		/// 无命令
		COMMAND_NOTHING			= 0,
		// 窗口命令
		/// 窗口命令标示
		COMMAND_WINDOW			= 10,
		/// 窗口退出命令
		COMMAND_QUIT,

		// 操作命令
		/// 操作命令标示
		COMMAND_OPERATION		= 20,
		/// 按键设备按下事件
		COMMAND_KEY_DOWN,
		/// 按键设备抬起事件
		COMMAND_KEY_UP,
		/// 指针设备按下事件
		COMMAND_CURSOR_DOWN,
		/// 指针设备抬起事件
		COMMAND_CURSOR_UP,
		/// 指针设备移动事件
		COMMAND_CURSOR_MOVE,

		/// 事件定义结尾标示
		COMMAND_END
	};
}
typedef GAF::CommandType			GAF_ECommandType;
#define GAF_COMMAND_NOTHING			GAF::COMMAND_NOTHING
//#define GAF_COMMAND_WINDOW			GAF::COMMAND_WINDOW
#define GAF_COMMAND_QUIT			GAF::COMMAND_QUIT
//#define GAF_COMMAND_OPERATION			GAF::COMMAND_OPERATION
#define GAF_COMMAND_KEY_DOWN			GAF::COMMAND_KEY_DOWN
#define GAF_COMMAND_KEY_UP			GAF::COMMAND_KEY_UP
#define GAF_COMMAND_CURSOR_DOWN			GAF::COMMAND_CURSOR_DOWN
#define GAF_COMMAND_CURSOR_UP			GAF::COMMAND_CURSOR_UP
#define GAF_COMMAND_CURSOR_MOVE			GAF::COMMAND_CURSOR_MOVE
//#define GAF_COMMAND_END			GAF::COMMAND_END

/// 判定是否为窗口事件
#define GAF_COMMAND_ISWINDOW(_nCommandID)	((_nCommandID) > GAF::COMMAND_WINDOW && (_nCommandID) < GAF::COMMAND_OPERATION)
/// 判定是否为命令事件
#define GAF_COMMAND_ISOPERATION(_nCommandID)	((_nCommandID) > GAF::COMMAND_OPERATION && (_nCommandID) < GAF::COMMAND_END)

#define GAF_PARAM_MAKE(_lHigh, _lLow)		((_lHigh << 16) | _lLow)
#define GAF_PARAM_HIGH(_lParam)			(_lParam >> 16)
#define GAF_PARAM_LOW(_lParam)			(_lParam & 0xffff)

namespace GAF
{
	/// 系统事件结构
	struct Command
	{
		/// 系统事件编号
		UINT			nCmdID;
		/// 事件参数1
		ULONG			lParam1;
		/// 事件参数2
		ULONG			lParam2;

		Command()
		{
			Reset();
		}

		/// 重置结构体
		void Reset()
		{
			nCmdID		= COMMAND_NOTHING;
			lParam1		= 0;
			lParam2		= 0;
		}
	};
}

#endif
